<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/context/mytags.jsp"%>
<!DOCTYPE html >
<html>
<head>
	<t:base type="jquery,easyui,tools,DatePicker,autocomplete,layer,multiple-select"></t:base>
	<style type="text/css">
		.btn {
		    border-color: rgba(0, 0, 0, 0.15) rgba(0, 0, 0, 0.15) rgba(0, 0, 0, 0.25);
		}
		.btn {
		    -moz-border-bottom-colors: none;
		    -moz-border-left-colors: none;
		    -moz-border-right-colors: none;
		    -moz-border-top-colors: none;
		    background-color: #f5f5f5;
		    background-image: -moz-linear-gradient(center top , #fff, #e6e6e6);
		    background-repeat: repeat-x;
		    border-color: #e6e6e6 #e6e6e6 #a2a2a2;
		    border-image: none;
		    border-radius: 4px;
		    border-style: solid;
		    border-width: 1px;
		    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.2) inset, 0 1px 2px rgba(0, 0, 0, 0.05);
		    color: #333;
		    cursor: pointer;
		    display: inline-block;
		    font-size: 14px;
		    line-height: 20px;
		    margin-bottom: 0;
		    padding: 4px 14px;
		    text-align: center;
		    text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75);
		    vertical-align: middle;
		}
		.btn:hover{
			color: #333;
			background-color: #e6e6e6;
		}
	</style>
</head>
<body>
<div class="easyui-layout" fit="true">
	<div region="center" style="padding: 1px;">
		<t:datagrid name="roleList" title="角色列表" fit="true" fitColumns="false" actionUrl="roleController.do?roleGrid" idField="id">
			<t:dgCol title="编号" field="id" align="center" hidden="false"></t:dgCol>
			<t:dgCol title="角色编码" width="100" field="roleCode" halign="center" align="left"></t:dgCol>
			<t:dgCol title="角色名称" width="100" field="roleName" query="true" halign="center" align="left"></t:dgCol>
			<t:dgCol title="操作" width="120" field="opt" align="center"></t:dgCol>
			<t:dgFunOpt funname="delRole(id)" title="删除"></t:dgFunOpt>
			<t:dgFunOpt funname="setfunbyrole(id,roleName)" title="权限设置"></t:dgFunOpt>
			<t:dgToolBar title="角色录入" icon="icon-add" url="roleController.do?addorupdate" funname="add"></t:dgToolBar>
			<t:dgToolBar title="角色编辑" icon="icon-edit" url="roleController.do?addorupdate" funname="update"></t:dgToolBar>
		</t:datagrid>
	</div>
</div>
<div region="east" style="width: 400px;" split="true">
	<div tools="#tt" class="easyui-panel" title="权限设置" style="padding: 10px;" fit="true" border="false" id="function-panel"></div>
</div>
<div id="tt"></div>
</body>
</html>

<script type="text/javascript">
	
	function setfunbyrole(id,roleName) {
		$("#function-panel").panel(
			{
				title :roleName+":当前权限",
				href:"roleController.do?fun&roleId=" + id
			}
		);
		$('#function-panel').panel("refresh" );
		
	}
	//删除角色
	function delRole(id){
		var tabName= 'roleList';
		var url= 'roleController.do?delRole&id='+id;
		$.dialog.confirm('确定删除该记录吗', function(){
			doSubmit(url,tabName);
			rowid = '';
			$("#function-panel").html("");//删除角色后，清空对应的权限
		}, function(){
		});
	}
</script>
